-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Snippets] Add debug caps for dumping snippets parameters #28378
[Snippets] Add debug caps for dumping snippets parameters #28378
Conversation
e397c92
to
046410a
Compare
src/common/snippets/include/snippets/lowered/pass/brgemm_blocking.hpp
Outdated
Show resolved
Hide resolved
src/common/snippets/include/snippets/lowered/pass/brgemm_blocking.hpp
Outdated
Show resolved
Hide resolved
cfaf273
to
053a7b4
Compare
053a7b4
to
4aa19d8
Compare
src/common/snippets/include/snippets/utils/debug_caps_config.hpp
Outdated
Show resolved
Hide resolved
src/common/snippets/include/snippets/lowered/pass/brgemm_blocking.hpp
Outdated
Show resolved
Hide resolved
5ecff19
to
f2ab0f0
Compare
4229be8
to
1fe9e26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be also useful to dump Subgraph's name as well. Let's discuss possible options offline
src/common/snippets/include/snippets/lowered/pass/brgemm_debug_params.hpp
Outdated
Show resolved
Hide resolved
src/common/snippets/include/snippets/lowered/pass/brgemm_debug_params.hpp
Outdated
Show resolved
Hide resolved
src/common/snippets/include/snippets/lowered/pass/brgemm_debug_params.hpp
Outdated
Show resolved
Hide resolved
src/common/snippets/include/snippets/lowered/pass/brgemm_debug_params.hpp
Outdated
Show resolved
Hide resolved
src/common/snippets/include/snippets/lowered/pass/brgemm_debug_params.hpp
Outdated
Show resolved
Hide resolved
src/common/snippets/include/snippets/lowered/pass/brgemm_debug_params.hpp
Outdated
Show resolved
Hide resolved
src/common/snippets/include/snippets/lowered/pass/brgemm_debug_params.hpp
Outdated
Show resolved
Hide resolved
Done |
eb64b0b
to
c85ad56
Compare
src/common/snippets/include/snippets/lowered/pass/brgemm_debug_params.hpp
Outdated
Show resolved
Hide resolved
src/common/snippets/include/snippets/lowered/pass/brgemm_debug_params.hpp
Outdated
Show resolved
Hide resolved
821ff78
to
e4751c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
src/common/snippets/include/snippets/lowered/pass/brgemm_debug_params.hpp
Outdated
Show resolved
Hide resolved
src/common/snippets/include/snippets/lowered/pass/brgemm_debug_params.hpp
Outdated
Show resolved
Hide resolved
a75589b
to
cb4be59
Compare
80a8569
to
cf39027
Compare
: PerfCountEndBase({pc_begin}), | ||
accumulation(0ul), | ||
iteration(0u), | ||
dumpers(dumpers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid redundant copy, since you are passing by value
dumpers(dumpers) { | |
dumpers(std::move(dumpers)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
class Dumper { | ||
public: | ||
Dumper() = default; | ||
Dumper(const Dumper&) = delete; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting 🤔
Why do we delete default copy constructors here and in the derived classes?
We don't manage any resources using pointers, so the default-generated would work as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug leftovers, removed
auto accumulation = node->get_accumulation(); | ||
auto iteration = node->get_iteration(); | ||
OPENVINO_ASSERT(accumulation.size() == iteration.size(), "accumulation size should be the same as iteration size in perf_count_end node."); | ||
auto iterator_iter = iteration.begin(); | ||
auto iterator_acc = accumulation.begin(); | ||
int t_num = 0; | ||
uint64_t avg_max = 0; | ||
std::cout << "Perf count data in perfCountEnd node with name " << node->get_friendly_name() << " is:" << std::endl; | ||
for (; iterator_iter != iteration.end(); ++iterator_iter, ++iterator_acc) { | ||
const auto iter = *iterator_iter; | ||
const auto acc = *iterator_acc; | ||
uint64_t avg = iter == 0 ? 0 : acc / iter; | ||
if (avg > avg_max) | ||
avg_max = avg; | ||
std::cout << "accumulated time:" << acc << "ns, iteration:" << iter << " avg time:" << avg << "ns" << " on thread:" << t_num << std::endl; | ||
t_num++; | ||
} | ||
|
||
// max time of all threads: combine for reduce max | ||
auto BinaryFunc = [](const uint64_t& a, const uint64_t& b) { | ||
return a >= b ? a : b; | ||
}; | ||
|
||
// max accumulation | ||
uint64_t acc_max = accumulation.combine(BinaryFunc); | ||
std::cout << "max accumulated time:" << acc_max << "ns" << std::endl; | ||
// max avg | ||
std::cout << "max avg time:" << avg_max << "ns" << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you decided to retain the old behavior, where the output is printed on every iteration instead of printing it once in the destructor. Is there any particular reason why?
As we discussed on the meeting, this approach have higher runtime overheads that might be important when we have nested perf counters. Moreover now we have two dumpers with mismatching behavior, which might be confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason, actually. Moved to destructor, aligned behavior
355a01c
to
e2cfa14
Compare
CSVDumper::CSVDumper(const std::string& csv_path) : csv_path(csv_path) {} | ||
|
||
CSVDumper::~CSVDumper() { | ||
dump_brgemm_params_to_csv(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the dump_brgemm_params_to_csv
method is redundant, please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, removed
class ConsoleDumper : public Dumper { | ||
public: | ||
ConsoleDumper() = default; | ||
ConsoleDumper(const ConsoleDumper&) = delete; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and in CSVDumper: why do you keep deleting copy constructors? 🙃
There must be a reason for it, could you share?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I stopped removing constructors now
*/ | ||
class CSVDumper : public Dumper { | ||
public: | ||
CSVDumper(const std::string &csv_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please pass by value and use std::move to avoid extra copy, like in this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
e2cfa14
to
2c3ee1b
Compare
Details:
OV_SNIPPETS_DUMP_PARAMS
environment variableTickets: